package rm.metrology.shared;

import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;


public enum EquipmentEnum {

	ANALOGUE("Analogue"), 
	DIGITAL("Digital");
	
	private String fName;
	
	private static List<String> fUnmodifiableEnumNames;
	
	private EquipmentEnum(String name) {
		fName = name;
	}
	
	@Override
	public String toString() {
		return fName;
	}
	
	public static EquipmentEnum toEnum(String name) {
		for (EquipmentEnum t : EnumSet.allOf(EquipmentEnum.class)) {
			if (t.toString().equalsIgnoreCase(name)) {
				return t;
			}
		}
		throw new IllegalArgumentException("CalibrationType Invalid: " + name);
	}

	public static List<String> toEnumNames() {
		if (fUnmodifiableEnumNames == null) {
			List<String> tmpList = new ArrayList<String>();
			for (EquipmentEnum t : EnumSet.allOf(EquipmentEnum.class)) {
				tmpList.add(t.toString());
			}
			fUnmodifiableEnumNames = Collections.unmodifiableList(tmpList);
		}
		return fUnmodifiableEnumNames;
	}
		
}
